/* 
 * File:   matrix.h
 * Author: gustavo
 *
 * Created on July 15, 2011, 2:57 PM
 */

#ifndef MATRIX_H
#define	MATRIX_H

#ifdef	__cplusplus
extern "C" {
#endif

	typedef struct _matrix Matrix;

	struct _matrix {
		int rows;			/* number of rows */
		int columns;		/* number of columns */
		//int channels;		/* number of channels */
		
		long int size;		/* number of elements of matrix */
		
		double * data;		/* stored data pointer */
	};
	
	Matrix * matrix_new(int rows, int columns);
	Matrix * matrix_new_square(int dim);
	Matrix * matrix_new_identity(int dim);
	Matrix * matrix_new_ones(int dim);
	Matrix * matrix_new_rand(int rows, int columns, double min, double max);
	Matrix * matrix_new_copy(const Matrix * A);
	
	void matrix_delete(Matrix * A);
	void matrix_print(const Matrix * A);
	void matrix_print3x3(const Matrix * M, int x, int y);
	
	void matrix_copy(const Matrix * src, Matrix ** dest);
	void matrix_clear( Matrix * A);

	/* get value at index */
	double matrix_get_val(Matrix * A, int idx);
	
	void matrix_normailze(Matrix * A, double min, double max);
	
	void matrix_get_normailzed(Matrix * A, Matrix ** B, double min, double max);

#ifdef	__cplusplus
}
#endif

#endif	/* MATRIX_H */

